﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace RemoteImaging.Controls
{
    public partial class TimeRangeEdit : XtraUserControl
    {
        public DateTime From
        {
            get
            {
                return (DateTime)from.EditValue;
            }
            set
            {
                from.EditValue = value;
            }
        }

        public DateTime To
        {
            get
            {
                return (DateTime)to.EditValue;
            }
            set
            {
                to.EditValue = value;
            }
        }

        public TimeRangeEdit()
        {
            InitializeComponent();


            var now = DateTime.Now;
            //now.AddMilliseconds(-now.Millisecond);
            to.EditValue = now;
            from.EditValue = now.AddHours(-1);
        }


        private void TimeRangeEdit_Validating(object sender, CancelEventArgs e)
        {
            e.Cancel = !dxValidationProvider1.Validate();

            System.Diagnostics.Debug.WriteLine("in TimeRangeEdit: " + e.Cancel);
        }
    }
}
